package newspaper;

import java.util.ArrayList;
import java.util.List;

import service.VnexpressMessageSeller;

public class VnexpressThreadManager {

	public static boolean started = false;
	public static VnexpressMessageSeller sender;
	public static List<VnexpressContent> listContentThread;
	public static List<VnexpressURL> listURLThread;
	public static List<VnexpressImage> listImageThread;

	@SuppressWarnings("deprecation")
	public static void stopAll() {
		sender.stop();
		for (VnexpressContent contentThread : listContentThread) {
			contentThread.stop();
		}
		for (VnexpressURL urlThread : listURLThread) {
			urlThread.stop();
		}
		for (VnexpressImage imageThread : listImageThread) {
			imageThread.stop();
		}
		initAll();
		started = false;
		System.out.println("Stop all thread success !");
	}

	public static void initAll() {
		sender = null;
		listContentThread = new ArrayList<VnexpressContent>();
		listURLThread = new ArrayList<VnexpressURL>();
		listImageThread = new ArrayList<VnexpressImage>();
	}
}
